
public class test{

    public static void main(String[] args) {

        int n;

        n=Integer.parseInt(args[0]);

        if((n<1)||(args[0]==null))
 System.out.println("Tham so khong hop le \nTruyen lai tham so!!");

        else{
        System.out.println("So luong sinh vien can nhap vao la: " + n);

        int i,j;

	Sinhvien[] sv=new Sinhvien[n];

	for(i=0;i<n;i++){

                    System.out.println("Nhap vao sinh vien thu "+(i+1)+":");

                    sv[i]=new Sinhvien();
           
         sv[i].NhapThongTin();

	}

        System.out.println("**------------**--THONG TIN CUA SINH VIEN--**------------**");

        System.out.println("|----------------------------------------------------------|");

        System.out.println("|       MSSV      |         HoTen      |     DiemThi       |");

        System.out.println("|----------------------------------------------------------|");

	for(i=0;i<n;i++){

            sv[i].HienThi();

        }

        float max = sv[0].getDiemThi();

        float min=sv[0].getDiemThi();

        for(i=0;i<n;i++){

                if((sv[i].getDiemThi() ) > max)

                {

                    max=sv[i].getDiemThi();//Gan gia tri max cho nhung sinh vien dat diem cao nhat

                }

                if(sv[i].getDiemThi() < min)

                {

                    min=sv[i].getDiemThi();// Gan gia tri min cho nhung sinh vien diem thap nhat

                }

            }

        //hien thi ra sinh vien co diem cao nhat

        System.out.println("\n\n");
        System.out.println("............................................................");

        System.out.println("**----------**--SINH VIEN DAT DIEM CAO NHAT--**-----------**");

        System.out.println("|----------------------------------------------------------|");

        System.out.println("|       MSSV      |         HoTen      |     DiemThi       |");

        System.out.println("|----------------------------------------------------------|");

        for(i=0;i<n;i++){

            if(sv[i].getDiemThi() == max )

                sv[i].HienThi();

            }

        //sinh vien co diem thap nhat
        

        
System.out.println("\n\n");
        System.out.println("............................................................");

        System.out.println("**----------**--SINH VIEN DAT DIEM THAP NHAT--**----------**");

        System.out.println("|----------------------------------------------------------|");

        System.out.println("|       MSSV      |         HoTen      |     DiemThi       |");

        System.out.println("|----------------------------------------------------------|");

        for(i=0;i<n;i++){

            if(sv[i].getDiemThi()==min)

                sv[i].HienThi();

        }

        float sum=0;
 
        for(i=0;i<n;i++){

            sum=sum +sv[i].getDiemThi();

        }

        //nhung sinh vien co diem tren 4

        
System.out.println("\n\n");
        System.out.println("............................................................");

        System.out.println("**-------------**--SINH VIEN DAT TREN 4.0--**-------------**");

        System.out.println("|----------------------------------------------------------|");

        System.out.println("|       MSSV      |         HoTen      |     DiemThi       |");

        System.out.println("|----------------------------------------------------------|");

        for(i=0;i<n;i++){

            if(sv[i].getDiemThi() > 4.0 ){

                sv[i].HienThi();

            }

        }

       float tbc =(sum/(float)n);
	
        

        
System.out.println("\n\n");
        System.out.println("............................................................");




        System.out.println("**------------**--THONG TIN CUA SINH VIEN--**------------**");

        System.out.println("|----------------------------------------------------------|");
        System.out.println("|       MSSV      |         HoTen      |     DiemThi       |");

        System.out.println("|----------------------------------------------------------|");

	for(i=0;i<n;i++){

            sv[i].HienThi();

        }

        System.out.println("| Diem trung binh |                    |  \t"+tbc+"    |");

        System.out.println("|----------------------------------------------------------|");

    }

}

}